{"doc": "The `pw.io.minio.read()` function reads a table from one or several objects in CSV format from an S3 bucket in MinIO. It takes in parameters like path, minio_settings, value_columns, id_columns, csv_settings, mode, types, default_values, autocommit_duration_ms, persistent_id, and debug_data. It returns a Table object, which contains the data from the CSV files. An example usage of this function is also provided.\npw.io.minio.read(path, minio_settings, value_columns, id_columns=None, csv_settings=None, mode='streaming', types=None, default_values=None, autocommit_duration_ms=None, persistent_id=None, debug_data=None, \\*\\*kwargs)\nReads a table from one or several objects in CSV format from S3 bucket in MinIO.\n\nIn case the prefix is specified, and there are several objects lying under this\nprefix, their order is determined according to their modification times: the smaller\nthe modification time is, the earlier the file will be passed to the engine.\n\n\n* Parameters\n\n    * path (`str`) \u2013 Path to an object or to a folder of objects in MinIO S3 bucket.\n\n    * minio_settings (`MinIOSettings`) \u2013 Connection parameters for the MinIO account and the bucket.\n\n    * value_columns (`List`\\[`str`\\]) \u2013 Names of the columns to be extracted from the files.\n\n    * id_columns (`Optional`\\[`List`\\[`str`\\]\\]) \u2013 In case the table should have a primary key generated according to\n        a subset of its columns, the set of columns should be specified in this field.\n        Otherwise, the primary key will be generated randomly.\n\n    * csv_settings (`Optional`\\[`CsvParserSettings`\\]) \u2013 The settings for the CSV parser.\n\n    * mode (`str`) \u2013 If set to \u201cstreaming\u201d, the engine will wait for the new input files in the bucket, which fall under the path prefix. Set it to \u201cstatic\u201d, it will onlyconsider the available data and ingest all of it in one commit. Default value is\u201dstreaming\u201d.\n\n    * types (`Optional`\\[`Dict`\\[`str`, `PathwayType`\\]\\]) \u2013 Dictionary containing the mapping between the columns and the data types (`pw.Type`) of the values of those columns. This parameter is optional, and if not provided the default type is `pw.Type.ANY`.\n\n    * default_values (`Optional`\\[`Dict`\\[`str`, `Any`\\]\\]) \u2013 dictionary containing default values for columns replacing\n        blank entries. The default value of the column must be specified explicitly,\n        otherwise there will be no default value.\n\n    * autocommit_duration_ms (`Optional`\\[`int`\\]) \u2013 the maximum time between two commits. Every\n        autocommit_duration_ms milliseconds, the updates received by the connector are\n        committed and pushed into Pathway\u2019s computation graph.\n\n    * persistent_id (`Optional`\\[`int`\\]) \u2013 (unstable) An identifier, under which the state of the table will be persisted or `None`, if there is no need to persist the state of this table. When a program restarts, it restores the state for all input tables according to what was saved for their `persistent_id`. This way it\u2019s possible to configure the start of computations from the moment they were terminated last time.\n\n    * debug_data \u2013 Static data replacing original one when debug mode is active.\n\n\n\n* Returns\n\n    *Table* \u2013 The table read.\n\n\nExample:\n\nConsider that there is a table, which is stored in CSV format in the min.io S3\nbucket. Then, you can use this method in order to connect and acquire its contents.\n\nIt may look as follows:\n\n\n```python\nimport os\nimport pathway as pw\nt = pw.io.minio.read(\n    \"animals/\",\n    minio_settings=pw.io.minio.MinIOSettings(\n        bucket_name=\"datasets\",\n        endpoint=\"avv749.stackhero-network.com\",\n        access_key=os.environ[\"MINIO_S3_ACCESS_KEY\"],\n        secret_access_key=os.environ[\"MINIO_S3_SECRET_ACCESS_KEY\"],\n    ),\n    value_columns=[\"owner\", \"pet\"],\n)\n```\n"}
{"doc": "This documentation describes the DateTimeNamespace class in the Pathway framework. It contains methods related to DateTimes, which can be accessed using the \"dt\" attribute of an expression. The example code demonstrates how to use these methods to create a table with datetime values and then extract the day values from them.\nclass  pw.DateTimeNamespace(expression)\n\nA module containing methods related to DateTimes.\nThey can be called using a dt attribute of an expression.\n\nTypical use:\n\n\n```python\nimport pathway as pw\ntable = pw.debug.table_from_markdown(\n    '''\n     |         t1\n   1 | 2023-05-15T14:13:00\n'''\n)\ntable_with_datetime = table.select(t1=table.t1.dt.strptime(\"%Y-%m-%dT%H:%M:%S\"))\ntable_with_days = table_with_datetime.select(day=table_with_datetime.t1.dt.day())\n```\n"}
{"doc": "The `add_duration_in_timezone` function is defined in the pathway framework. It adds a given duration to a datetime value while taking into account the specified timezone. It takes two parameters, `duration` and `timezone` which can be either a `ColumnExpression` or a `Duration` object and a string respectively. The function returns a `DateTimeNaive` or `DateTimeUtc` object depending on the type of object the method was called upon. The example code demonstrates how to use the function to add two hours to a datetime value and convert it to a new timezone.\nadd_duration_in_timezone(duration, timezone)\nAdds Duration to DateTime taking into account time zone.\n\n\n* Parameters\n\n    * duration (`Union`\\[`ColumnExpression`, `Duration`\\]) \u2013 Duration to be added to DateTime.\n\n    * timezone (`Union`\\[`ColumnExpression`, `str`\\]) \u2013 The time zone to perform addition in.\n\n\n\n* Returns\n\n    DateTimeNaive or DateTimeUtc depending on the type of an object                 the method was called on\n\n\nExample:\n\n\n\nCode\n```python\nimport pathway as pw\nimport datetime\nt1 = pw.debug.table_from_markdown(\n    '''\n     |        date\n   1 | 2023-03-26T01:23:00\n   2 | 2023-03-27T01:23:00\n   3 | 2023-10-29T01:23:00\n   4 | 2023-10-30T01:23:00\n'''\n)\nfmt = \"%Y-%m-%dT%H:%M:%S\"\nt2 = t1.select(date=pw.this.date.dt.strptime(fmt=fmt))\nt3 = t2.with_columns(\n    new_date=pw.this.date.dt.add_duration_in_timezone(\n        datetime.timedelta(hours=2), timezone=\"Europe/Warsaw\"\n    ),\n)\npw.debug.compute_and_print(t3, include_id=False)\n```\n::\nResult\n```\ndate                | new_date\n2023-03-26 01:23:00 | 2023-03-26 04:23:00\n2023-03-27 01:23:00 | 2023-03-27 03:23:00\n2023-10-29 01:23:00 | 2023-10-29 02:23:00\n2023-10-30 01:23:00 | 2023-10-30 03:23:00\n```\n::\n::\n"}
{"doc": "The `day()` function is part of the pathway framework and is used to extract the day from a given DateTime object. The function returns an integer value representing the day of the month (1 to 31). The documentation also provides an example of how to use the function with a sample code snippet and its output.\nday()\nExtracts day from a DateTime.\n\n\n* Returns\n\n    Day as int. 1 <= day <= 31 (depending on a month)\n\n\nExample:\n\n\n\nCode\n```python\nimport pathway as pw\ntable = pw.debug.table_from_markdown(\n    '''\n     |               t1\n   1 | 1974-03-12T00:00:00\n   2 | 2023-03-25T12:00:00\n   3 | 2023-05-15T14:13:00\n'''\n)\ntable_with_datetime = table.select(t1=table.t1.dt.strptime(\"%Y-%m-%dT%H:%M:%S\"))\ntable_with_days = table_with_datetime.select(day=table_with_datetime.t1.dt.day())\npw.debug.compute_and_print(table_with_days, include_id=False)\n```\n::\nResult\n```\nday\n12\n15\n25\n```\n::\n::\n"}
{"doc": "The documentation describes the `days()` function in the Pathway framework which returns the total number of days in a duration. The function takes no parameters and returns an integer value representing the number of days. The example provided demonstrates how to use the function in a table with datetime values. It subtracts two datetime values to obtain a duration and then applies the `days()` function to compute the number of days in the duration. The result is a table with a new column \"days\" containing the number of days represented as integers.\ndays()\nThe total number of days in a Duration.\n\n\n* Returns\n\n    Days as int.\n\n\nExample:\n\n\n\nCode\n```python\nimport pathway as pw\ntable = pw.debug.table_from_markdown(\n    '''\n     |         t1          |         t2\n   0 | 2023-03-15T00:00:00 | 2023-05-15T10:13:23\n   1 | 2023-04-15T00:00:00 | 2023-05-15T10:00:00\n   2 | 2023-05-01T10:00:00 | 2023-05-15T10:00:00\n   3 | 2023-05-15T10:00:00 | 2023-05-15T09:00:00\n   4 | 2023-05-15T10:00:00 | 2023-05-15T11:00:00\n   5 | 2023-05-16T12:13:00 | 2023-05-15T10:00:00\n   6 | 2024-05-15T14:13:23 | 2023-05-15T10:00:00\n'''\n)\nfmt = \"%Y-%m-%dT%H:%M:%S\"\ntable_with_datetimes = table.select(\n    t1=pw.this.t1.dt.strptime(fmt=fmt), t2=pw.this.t2.dt.strptime(fmt=fmt)\n)\ntable_with_diff = table_with_datetimes.select(diff=pw.this.t1 - pw.this.t2)\ntable_with_days = table_with_diff.select(days=pw.this[\"diff\"].dt.days())\npw.debug.compute_and_print(table_with_days, include_id=False)\n```\n::\nResult\n```\ndays\n-61\n-30\n-14\n0\n0\n1\n366\n```\n::\n::\n"}
{"doc": "The `floor(duration)` function in Pathway framework truncates a DateTime object to the precision specified by the `duration` argument. The function returns a DateTimeNaive or a DateTimeUtc object depending on the type of the object the method was called on. The function takes one parameter, the `duration` (which can be a `ColumnExpression` or a `Duration`). The documentation also provides an example code snippet to demonstrate how the function can be used to truncate DateTime objects to hours, 10-minute intervals, and 15-second intervals.\nfloor(duration)\nTruncates DateTime to precision specified by duration argument.\n\n\n* Parameters\n\n    duration (`Union`\\[`ColumnExpression`, `Duration`\\]) \u2013 truncation precision\n\n\n\n* Returns\n\n    DateTimeNaive or DateTimeUtc depending on the type of an object                 the method was called on\n\n\nExamples:\n\n\n\nCode\n```python\nimport pathway as pw\nimport datetime\nt1 = pw.debug.table_from_markdown(\n    '''\n     |         date\n   1 | 2023-05-15T12:23:12\n   2 | 2023-05-15T12:33:21\n   3 | 2023-05-15T13:20:35\n   4 | 2023-05-15T13:51:41\n'''\n)\nfmt = \"%Y-%m-%dT%H:%M:%S\"\nt2 = t1.select(date=pw.this.date.dt.strptime(fmt=fmt))\nres = t2.with_columns(\n    truncated_to_hours=pw.this.date.dt.floor(datetime.timedelta(hours=1)),\n    truncated_to_10_min=pw.this.date.dt.floor(datetime.timedelta(minutes=10)),\n    truncated_to_15_s=pw.this.date.dt.floor(datetime.timedelta(seconds=15)),\n)\npw.debug.compute_and_print(res, include_id=False)\n```\n::\nResult\n```\ndate                | truncated_to_hours  | truncated_to_10_min | truncated_to_15_s\n2023-05-15 12:23:12 | 2023-05-15 12:00:00 | 2023-05-15 12:20:00 | 2023-05-15 12:23:00\n2023-05-15 12:33:21 | 2023-05-15 12:00:00 | 2023-05-15 12:30:00 | 2023-05-15 12:33:15\n2023-05-15 13:20:35 | 2023-05-15 13:00:00 | 2023-05-15 13:20:00 | 2023-05-15 13:20:30\n2023-05-15 13:51:41 | 2023-05-15 13:00:00 | 2023-05-15 13:50:00 | 2023-05-15 13:51:30\n```\n::\n::\n"}